<?php
session_start();

include_once '../../web_inc.php';
include_once ROOT_PATH.'/config/db_conn.php';
include_once './inc/gy_info_class.php';
//include_once './check_login.php';   //用户登录验证文件，正式环境下必须开启！！！测试注释掉
$del=new getInfo_gy();
$id=$_GET[id];

if($_GET[leibie]=="gy"){
	$table='gylist';
    $del_gylist2=mysql_query("delete from gylist_2 where gy_id=$id");
    $pic_sql=mysql_query("select spic from $table where id=$id");
	$pic=mysql_fetch_array($pic_sql);

    if(!empty($pic[spic])){
	    unlink("upload/".$pic[spic]."");
	}
	$del->del($table,$id);
    echo "<script language='javascript'>alert('删除成功!');history.back();</script>";

}

/*批量删除*/
if($_GET[leibie]=="gy_all"){
	 $table='gylist';
     if($chkSon!=""){              
	    $del_num=count($chkSon);              
	    for($i=0;$i<$del_num;$i++){                  
		       //mysql_query("Delete from food where id='$chkSon[$i]'");
		       $del_gylist2=mysql_query("delete from gylist_2 where gy_id='$chkSon[$i]'");
               $pic_sql=mysql_query("select spic from $table where id='$chkSon[$i]'");
	           $pic=mysql_fetch_array($pic_sql);
               if(!empty($pic[spic])){
	             unlink("upload/".$pic[spic]."");
			   }
	           $del->del($table,$chkSon[$i]);

	    }               
	   echo("<script type='text/javascript'>alert('批量删除成功！');history.back();</script>");       
    }else{              
	   echo("<script type='text/javascript'>alert('请先选择项目！');history.back();</script>");       
    }  

}
/*批量删除结束*/

if($_GET[leibie]=="xq"){
	$table='xqlist';
}

if($_GET[leibie]=="bb"){
	$table='bb_bb';
}



